// 用户相关类型
export interface User {
  id: number
  username: string
  realName: string
  role: UserRole
  permissions: Permission[]
  email?: string
  phone?: string
  createdAt: string
}

export enum UserRole {
  ADMIN = 'admin',
  TEACHER = 'teacher',
  COUNSELOR = 'counselor'
}

export enum Permission {
  STUDENT_VIEW = 'student_view',
  STUDENT_EDIT = 'student_edit',
  STUDENT_DELETE = 'student_delete',
  STUDENT_IMPORT = 'student_import',
  STUDENT_EXPORT = 'student_export',
  GRADE_MANAGE = 'grade_manage',
  REWARD_MANAGE = 'reward_manage',
  PUNISHMENT_MANAGE = 'punishment_manage',
  USER_MANAGE = 'user_manage'
}

// 学生相关类型
export interface Student {
  id: number
  studentId: string // 学号
  name: string
  gender: '男' | '女'
  birthDate: string
  idCard: string
  major: string
  className: string
  grade: number // 年级
  enrollmentDate: string
  phone?: string
  email?: string
  address?: string
  emergencyContact?: string
  emergencyPhone?: string
  status: StudentStatus
  photo?: string
  createdAt: string
  updatedAt: string
}

export enum StudentStatus {
  ENROLLED = 'enrolled', // 在读
  GRADUATED = 'graduated', // 毕业
  SUSPENDED = 'suspended', // 休学
  EXPELLED = 'expelled' // 退学
}

// 成绩相关类型
export interface Grade {
  id: number
  studentId: number
  semester: string // 学期，如 "2023-2024-1"
  courseName: string
  courseCode: string
  credit: number
  score: number
  gradePoint?: number
  examType: '期末' | '期中' | '平时'
  teacherId: number
  teacherName: string
  createdAt: string
  updatedAt: string
}

// 奖励相关类型
export interface Reward {
  id: number
  studentId: number
  type: string // 奖学金、荣誉称号、竞赛获奖等
  name: string
  level: '国家级' | '省级' | '校级' | '院级'
  awardDate: string
  description?: string
  certificate?: string // 证书文件路径
  createdBy: number
  createdAt: string
}

// 惩罚相关类型
export interface Punishment {
  id: number
  studentId: number
  type: string // 警告、严重警告、记过等
  reason: string
  date: string
  description?: string
  revokeDate?: string // 撤销日期
  createdBy: number
  createdAt: string
}

// API响应类型
export interface ApiResponse<T = any> {
  code: number
  message: string
  data: T
}

export interface PaginationParams {
  page: number
  pageSize: number
}

export interface PaginationResult<T> {
  list: T[]
  total: number
  page: number
  pageSize: number
  totalPages: number
}

// 筛选条件
export interface StudentFilter {
  keyword?: string
  major?: string
  className?: string
  grade?: number
  status?: StudentStatus
  gender?: '男' | '女'
}

// 登录相关
export interface LoginForm {
  username: string
  password: string
}

export interface LoginResponse {
  token: string
  user: User
}

